<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <ul>
    <li class="woman">小红</li>
    <li class="man">小明</li>
    <li class="man">小强</li>
    <li class="woman">小兰</li>
  </ul>
  <script>
    // 根据类名woman获取元素
    var women = document.getElementsByClassName('woman');
    // 根据类名man获取元素
    var men = document.getElementsByClassName('man');
    // 输出类名为womon的第1个元素
    console.log(women[0]);
    // 输出类名为man的第1个元素
    console.log(men[0]);
  </script>
</body>
</html>